<?php

declare(strict_types=1);

namespace app\api\model;

use Exception;
use think\Model;

/**
 * @mixin \think\Model
 */
class UserNotLikeProduct extends Model
{
    //不喜欢表
    public static function notLikeProductModel($product_id, $user_id)
    {
        $row = self::where(['product_id' => $product_id, 'user_id' => $user_id])->find();
        if (!$row) {
            return self::create(['product_id' => $product_id, 'user_id' => $user_id]);
        } else {
            return $row->delete(); //取消
        }
    }
}
